package com.learn.sqlsession;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author WuLiangHang
 */
public interface SqlSession {

    /**
     * 查询多个结果
     *
     * @param statementId
     * @param args
     * @param <E>
     * @return
     */
    <E> List<E> queryForList(String statementId, Object... args) throws SQLException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException, InvocationTargetException, IntrospectionException, InstantiationException;

    /**
     * 查询单个结果
     *
     * @param statementId
     * @param args
     * @param <T>
     * @return
     */
    <T> T queryForOne(String statementId, Object... args) throws SQLException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException, InstantiationException, IntrospectionException, InvocationTargetException;

    <T> T getMapper(Class<?> mapperClass);
}
